﻿{{ define "cms/articleedit.html" }}

{{template "cms/headwitheditor.html"}}

<body>

<!-- Start wrapper-->
<div id="wrapper">
  {{template "cms/sidebar.html" .}}

  {{template "cms/topbar.html" .}}

  <div class="clearfix"></div>
  <div class="content-wrapper">
    <div class="container-fluid">
      <div class="row" style="min-height: 1000px">
        <div class="col-lg-12">

          <!-- 板块信息 -->
          <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
              <div><span>所属板块</span></div>
              {{range $topblocktitle, $subblockinfos := .blockinfos}}
              <div><span>{{$topblocktitle}}</span></div>
                {{range $subblockinfos}}
                <div class="form-check">
                  <input class="form-check-input" type="radio" name="articleBlockid" id="Blockid#{{.Id}}" value="{{.Title}}" {{if eq $.content.Blockid .Id}}checked{{end}}>
                  <label class="form-check-label" for="Blockid#{{.Id}}">
                    {{.Title}}
                  </label>
                </div>
                {{end}}
              {{end}}
            </div>
          </div>
          <!-- end板块信息 -->

          <!-- 优先级 -->
          <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
              <div class="input-group mb-3">
                <div class="input-group-prepend">
                  <span class="input-group-text" id="basic-addon1">优先级,数字越大优先级越低,0优先级最高</span>
                </div>
                <input type="text" class="form-control" id="articlePriority" aria-describedby="basic-addon1" value="{{.content.Priority}}">
              </div>
            </div>
          </div>
          <!-- end优先级 -->

          <!-- 题目 -->
          <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
              <div class="input-group mb-3">
                <div class="input-group-prepend">
                  <span class="input-group-text" id="basic-addon1">题目</span>
                </div>
                <input type="text" class="form-control" id="articleTitle" placeholder="输入题目" aria-label="articleTitle" aria-describedby="basic-addon1" value="{{.content.Title}}">
                <div>题目编号:<span id="articleId">{{.content.Id}}</span></div>
              </div>
            </div>
          </div>
          <!-- end题目 -->

          <!-- 关键词 -->
          <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
              <div class="input-group mb-3">
                <div class="input-group-prepend">
                  <span class="input-group-text" id="basic-addon1">关键词, 用空格分开</span>
                </div>
                <input type="text" class="form-control" id="articleKeywords" placeholder="输入关键词, 用空格分开" aria-label="articleKeywords" aria-describedby="basic-addon1" value="{{.content.Keywords}}">
              </div>
            </div>
          </div>
          <!-- end关键词 -->

          <!-- 简述 -->
          <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
              <div class="input-group mb-3">
                <div class="input-group-prepend">
                  <span class="input-group-text" id="basic-addon1">简述</span>
                </div>
                <input type="text" class="form-control" id="articleBrief" placeholder="输入简述" aria-label="articleBrief" aria-describedby="basic-addon1" value="{{.content.Brief}}">
              </div>
            </div>
          </div>
          <!-- end简述 -->

          <!-- 文章内容 -->
          <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12" style="height: 600px;">
              <div id="alerts">文章内容</div>
              <div id="articleContent">
                <!-- Tips: Editor.md can auto append a `<textarea>` tag -->
                <textarea style="display: none">{{.content.Content}}</textarea>
              </div>
            </div>
          </div>
          <!-- end文章内容 -->

          <!-- 备注 -->
          <div class="row" style="margin-top: 50px;">
            <div class="col-md-12 col-sm-12 col-xs-12">
              <div class="input-group mb-3">
                <div class="input-group-prepend">
                  <span class="input-group-text" id="basic-addon1">备注</span>
                </div>
                <input type="text" class="form-control" id="articleRemark" placeholder="备注" aria-label="articleTitle" aria-describedby="basic-addon1" value="{{.content.Remark}}">
              </div>
            </div>
          </div>
          <!-- end备注 -->

          <!-- 状态 -->
          <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
              <span>状态</span>
              <div class="form-check">
                <input class="form-check-input" type="radio" name="articleState" id="articleState{{.defset.state.debug.str}}" value="{{.defset.state.debug.str}}" {{if eq $.defset.state.debug.code .content.State}}checked{{end}}>
                <label class="form-check-label" for="articleState{{.defset.state.debug.str}}">
                  {{.defset.state.debug.str}}
                </label>
              </div>
              <div class="form-check">
                <input class="form-check-input" type="radio" name="articleState" id="articleState{{.defset.state.release.str}}" value="{{.defset.state.release.str}}" {{if eq $.defset.state.release.code .content.State}}checked{{end}}>
                <label class="form-check-label" for="articleState{{.defset.state.release.str}}">
                  {{.defset.state.release.str}}
                </label>
              </div>
            </div>
          </div>
          <!-- end状态 -->

          <!-- 提交按钮 -->
          <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
              <div id="submitButtons" class="row">
                <button type="button" class="btn btn-primary" onclick="ArticleEdit()">修改文章</button>
              </div>
            </div>
          </div>
          <!-- end提交按钮 -->

          <!-- 与后台的交互结果 -->
          <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
              <div class="input-group mb-3">
                <div class="input-group-prepend">
                  <span class="input-group-text" id="basic-addon1">后台返回</span>
                </div>
                <input type="text" class="form-control" id="backendInfo" placeholder="此处将显示后台返回信息" aria-describedby="basic-addon1">
              </div>
            </div>
          </div>
          <!-- end与后台的交互结果 -->

        </div>
      </div>
      <!--start overlay-->
      <div class="overlay toggle-menu"></div>
      <!--end overlay-->
    </div>
    <!-- End container-fluid-->

  </div><!--End content-wrapper-->

  <!--Start Back To Top Button-->
  <a href="javaScript:void();" class="back-to-top"><i class="fa fa-angle-double-up"></i> </a>
  <!--End Back To Top Button-->
	
  {{template "cms/footer.html"}}
	
</div><!--End wrapper-->

  {{template "cms/tail.html"}} <!-- javascripts -->

  <!-- extra editor.md javascripts -->
  <script src="/static/editor.md/editormd.min.js"></script>
  <script type="text/javascript">
    var editor;
    $(function() {
        editor = editormd("articleContent", {
            mode:         "markdown",              // gfm or markdown
            name:         "articleContent",    // Form element name for post
            width:        "100%",
            height:       "100%",
            saveHTMLToTextarea   : true,      // If enable, Editor will create a <textarea name="{editor-id}-html-code"> tag save HTML code for form post to server-side.
            // markdown: "xxxx",     // dynamic set Markdown text


            onfullscreen         : function() {alert("不支持全屏!请按esc退出");},
            onfullscreenExit     : function() {},

            path : "/static/editor.md/lib/"   // Autoload modules mode, codemirror, marked... dependents libs path
        });
    });
  </script>
  
  <script src="/static/myjs/cms/articleedit.js"></script>

</body>
</html>
{{ end }}
